home *** CD-ROM | disk | FTP | other *** search
/ SunSoft Catalyst CDWARE 1996 May to August / Catalyst CDWARE 1996 May to August.iso / .products / .bin / httpd / src / http_delete.c < prev    next >
C/C++ Source or Header  |  1995-05-18  |  2KB  |  61 lines

  1. /*
  2.  * http_delete.c: Handles DELETE
  3.  * 
  4.  * All code contained herein is covered by the Copyright as distributed
  5.  * in the README file in the main directory of the distribution of 
  6.  * NCSA HTTPD.
  7.  *
  8.  * Based on NCSA HTTPd 1.3 by Rob McCool
  9.  * 
  10.  */
  11.  
  12. #include "httpd.h"
  13.  
  14.  
  15. void handle_delete(char *name, char *args, int in, FILE *out) {
  16.     struct stat finfo;
  17.     char ct_bak[MAX_STRING_LEN];
  18.  
  19.     if(stat(name,&finfo) == -1) {
  20.         if(find_script("DELETE",name,args,in,out))
  21.             return;
  22.         if(errno==ENOENT) {
  23.             log_reason("file does not exist",name);
  24.             unmunge_name(name);
  25.             die(NOT_FOUND,name,out);
  26.         }
  27.         else {
  28.             log_reason("file permissions deny server access",name);
  29.             unmunge_name(name);
  30.             die(FORBIDDEN,name,out);
  31.         }
  32.     }
  33.     probe_content_type(name);
  34.     if(!strcmp(content_type,CGI_MAGIC_TYPE)) {
  35.         strcpy(content_type,ct_bak);
  36.         send_cgi("DELETE",name,"",args,&finfo,in,out);
  37.         return;
  38.     }
  39.     /* Not a script, do group ann thang */
  40.     die(NOT_IMPLEMENTED,"DELETE to non-script",out);
  41. }
  42.  
  43.  
  44. void delete_node(char *name, char *args, int in, FILE *out) {
  45.     int s;
  46.  
  47.     s=translate_name(name,out);
  48.  
  49.     switch(s) {
  50.       case STD_DOCUMENT:
  51.         handle_delete(name,args,in,out);
  52.         return;
  53.       case REDIRECT_URL:
  54.         die(REDIRECT,name,out);
  55.       case SCRIPT_CGI:
  56.         exec_cgi_script("DELETE",name,args,in,out);
  57.       default:
  58.         die(NOT_IMPLEMENTED,"NCSA script exeuction of delete",out);
  59.     }
  60. }
  61.